package com.hake.example.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageInfo;
import com.hake.core.exception.AppException;
import com.hake.core.exception.BusinessException;
import com.hake.core.exception.DataBaseException;
import com.hake.core.support.service.BaseService;
import com.hake.example.entity.User;
import com.hake.example.mapper.UserMapper;
import com.hake.example.service.UserService;
import com.hake.example.web.dto.UserInfo;

@Service
public class UserServiceImpl extends BaseService<User, Integer> implements UserService {
	
	@Autowired
	private UserMapper mapper ;

	@Override
	public List<User> selectList(UserInfo dto) throws DataBaseException, BusinessException, AppException {
		return this.mapper.selectList(dto);
	}
	
	@Override
	public PageInfo<User> selectPage(UserInfo dto) throws DataBaseException, BusinessException, AppException {
		return super.selectPage(null, "user.id desc") ;
	}

	@Cacheable(value="MenuCache" ,key="#root.targetClass +\".\"+ #root.methodName")
	@Override
	public PageInfo<User> selectPage(Map<String, Object> params) throws DataBaseException, BusinessException, AppException {
		return super.selectPage(params) ;
	}
}
